package com.tj.collection.enums;

/**
 * Created with IntelliJ IDEA.
 * User: sm
 * Date: 2017/11/22
 * Time: 上午9:57
 */
public enum ProductCategoryEnums {
    SDZZ("sdzzall", "新的闪电周转"),
    QSYQ("qsyqall", "轻松有钱"),
    SDZZOLD("sdzzold", "老闪电周转"),
    XJDR("xjdrall", "现金大人");
    private String category;
    private String desc;

    ProductCategoryEnums(String category, String desc) {
        this.category = category;
        this.desc = desc;
    }


    public String getCategory() {
        return category;
    }

    public ProductCategoryEnums setCategory(String category) {
        this.category = category;
        return this;
    }

    public String getDesc() {
        return desc;
    }

    public ProductCategoryEnums setDesc(String desc) {
        this.desc = desc;
        return this;
    }

    public static Boolean isOld(String productCategory) {
        ProductCategoryEnums[] values = ProductCategoryEnums.values();

        ProductCategoryEnums enums = null;
        for (ProductCategoryEnums productCategoryEnums : values) {
            if (productCategoryEnums.getCategory().equals(productCategory)) {
                enums = productCategoryEnums;
            }
        }

        if (enums == null) {
            return false;
        }

        return enums.equals(ProductCategoryEnums.SDZZOLD) || enums.equals(ProductCategoryEnums.XJDR);
    }
}

